package ar.edu.itba.it.paw.domain;

import java.util.Date;
import ar.edu.itba.it.paw.domain.User;


public class Opinion extends PersistentAttributes{

	String page_firstTime;
	OpinionType opinion;
	String comment;
	Date date;
	User user;
	
	public Opinion(String page_firstTime, Date date, OpinionType opinion, String comment, User user){
		this.setPage_firstTime(page_firstTime);
		this.setOpinion(opinion);
		this.setDate(date);
		this.setComment(comment);
		this.setUser(user);
	}

	public String getPage_firstTime() {
		return page_firstTime;
	}

	public void setPage_firstTime(String page_firstTime) {
		if(page_firstTime != null && !page_firstTime.equals("") && page_firstTime.length() <= 200)
			this.page_firstTime = page_firstTime;
		else
			throw new IllegalArgumentException();
	}

	public OpinionType getOpinion() {
		return opinion;
	}

	private void setOpinion(OpinionType opinion) {
		this.opinion = opinion;
	}

	public String getComment() {
		return comment;
	}

	private void setComment(String comment) {
		if(comment != null && comment.length() <= 200){
			this.comment = comment;
		}else if(comment == null){
			comment = "";
		}else{
			throw new IllegalArgumentException();
		}
	}

	public User getUser() {
		return user;
	}

	private void setUser(User user) {
		this.user = user;
	}

	public Date getDate() {
		return date;
	}

	private void setDate(Date date) {
		this.date = date;
	}

	@Override
	public String toString() {
		return "Opinion [page_firstTime=" + page_firstTime + ", opinion="
				+ opinion + ", comment=" + comment + ", date=" + date
				+ ", user=" + user + "]";
	}
}
